package com.aier.bean.report;

import com.aier.bean.common.CommonCode;
import com.aier.bean.common.FieldDescription;
import com.aier.bean.foreign.ForeignBase;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
import lombok.*;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;

import java.math.BigDecimal;

/**
 * 建仓报表
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
@ContentRowHeight(25)
@HeadStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
public class BuildsPosition extends ForeignBase {

    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ColumnWidth(15)
    @ExcelProperty(value = "总重量(Kg)",index = 17)
    @FieldDescription("总重量(Kg)")
    BigDecimal totalWeight;

    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ColumnWidth(15)
    @ExcelProperty(value = "单箱方数",index = 18)
    @FieldDescription("单箱方数")
    BigDecimal singleBoxVolumetric;

    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ColumnWidth(15)
    @ExcelProperty(value = "总方数",index = 19)
    @FieldDescription("总方数")
    BigDecimal totalVolumetric;

    public BuildsPosition(ForeignBase foreignBase){
        this.setFbaCode(foreignBase.getFbaCode());
        this.setTrackingNumber(foreignBase.getTrackingNumber());
        this.setWarehouseCode(foreignBase.getWarehouseCode());
        this.setAsin(foreignBase.getAsin());
        this.setSku(foreignBase.getSku());
        this.setPicture(foreignBase.getPicture());
        this.setBoxNum(foreignBase.getBoxNum());
        this.setPerBoxQty(foreignBase.getPerBoxQty());
        this.setBoxLength(foreignBase.getBoxLength());
        this.setBoxWidth(foreignBase.getBoxWidth());
        this.setBoxHeight(foreignBase.getBoxHeight());
        this.setWeight(foreignBase.getWeight());
        this.setBuildDate(foreignBase.getBuildDate());
        this.setStaffId(foreignBase.getStaffId());
        this.setStaffName(foreignBase.getStaffName());
        this.setPlatforms(CommonCode.platformsCode.get(foreignBase.getPlatforms()));
        this.setCountry(CommonCode.countryCode.get(foreignBase.getCountry()));
    }

}
